home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / ACORNUSERS / CBSA / EDUCATION / SAVER / cc / Test next >
Text File  |  1998-02-10  |  1KB  |  73 lines

  1.  
  2. //-----------------------------------
  3. //             Test.c
  4. //-----------------------------------
  5.  
  6. #include <string.h>
  7. #include <iostream.h>
  8. #include "os.h"
  9. #include "trap.h"
  10. #include "WimpTask.h"
  11. #include "WimpError.h"
  12. #include "WimpIcon.h"
  13.  
  14. WimpIcon *b;
  15. WimpIcon *c;
  16.  
  17. class MyTask : public WimpTask
  18. {
  19.   public:
  20.   
  21.   MyTask(char *);
  22.   bool ButtonPressed();
  23.   bool load(char *, int, int);
  24.   bool save(char *, int &);
  25. };
  26.  
  27. MyTask::MyTask(char *name) : WimpTask(name) 
  28. {
  29.   EnableEvent(EBUT);
  30.   EnableEvent(EUSERDRAG);
  31. }
  32.  
  33. bool MyTask::ButtonPressed()
  34. {
  35.   if ((Mouse_Click.window == -2) && (Mouse_Click.icon == *b))
  36.     return(TRUE);
  37.   if ((Mouse_Click.window == -2) && (Mouse_Click.icon == *c))
  38.   { 
  39.     c->drag();
  40.     return(FALSE);
  41.   }  
  42.   
  43.   return(FALSE);
  44. }
  45.  
  46. bool MyTask::load(char *filename, int size, int type)
  47. {
  48.   throw(filename);
  49.   return FALSE;
  50. }
  51.  
  52. bool MyTask::save(char *filename, int &l)
  53. {
  54.   throw(filename);
  55.   return FALSE;
  56. }
  57.  
  58. int main()
  59. {
  60.   MyTask a("CouCou"); 
  61.   b = new WimpIcon("my_sprite");
  62.   c = new WimpIcon("file_fff", WimpIcon::ISPRITE + 
  63.                                WimpIcon::IHCENTRE + 
  64.                                WimpIcon::IBTYPE*BDEBOUNCEDRAG);                   strcpy(a.FileName,"MonFichier");
  65.   c->drag(); // It's necessary,but I don't know why ?
  66.   a.run();
  67. }
  68.  
  69.  
  70.  
  71.  
  72.  
  73.